const Router = require('koa-router');
const controller = require('../controller/comment.controller');
const {
  verifyJwt,
  verifyPermission,
  validContent,
} = require('../middlewares/common.middleware');
const {
  validComment,
  validQuery,
} = require('../middlewares/comment.middleware');
const router = new Router({ prefix: '/comment' });

router.get('/', validQuery, controller.getList);
router.post('/create', verifyJwt, validComment(false), controller.create);
router.post('/reply', verifyJwt, validComment(true), controller.reply);
router.patch(
  '/:id',
  verifyJwt,
  verifyPermission('comment'),
  validContent,
  controller.update
);
router.delete(
  '/:id',
  verifyJwt,
  verifyPermission('comment'),
  controller.remove
);



module.exports = router;
